<?php

namespace Addons\Display;

use Common\Controller\Addon;

class DisplayAddon extends Addon
{
    public function _initialize()
    {
        parent::_initialize();
        C('TMPL_PARSE_STRING', [
            '__PUBLIC__' => $this->addon_relative_path,
            '__CSS__' => $this->addon_relative_path . '/Public/css',
            '__JS__' => $this->addon_relative_path . '/Public/js',
            '__IMG__' => $this->addon_relative_path . '/Public/images',
        ]);
    }

    public function register_hook()
    {
        return [
            'web_index_page',
            'web_index_empty',
        ];
    }

    public function web_index_page()
    {
        $this->display('index');
    }

    public function web_index_empty($name)
    {
        if ($name && is_file($this->getTmpl($name))) {
            $this->display($name);
        }
    }

    public function install()
    {
        return true;
    }

    public function uninstall()
    {
        return true;
    }

    public function start()
    {
        return true;
    }
}